﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using Javavaj.iHunter;
namespace Javavaj.iHunter.UI
{
    public partial class DocumentViewerForm : Form
    {
        public DocumentViewerForm()
        {
            InitializeComponent();
        }
        Control contentViewerControl = null;

        public void ShowDocument(IViewer viewer, string docType, System.IO.Stream doc)
        {
            if (contentViewerControl != null)
            {
                contentViewerControl.Hide();
                this.Controls.Remove(contentViewerControl);

                contentViewerControl.Dispose();
                contentViewerControl = null;
            }
            contentViewerControl = viewer.CreateControl();
            if (contentViewerControl == null)
                return;


            this.Controls.Add(contentViewerControl);
            contentViewerControl.Dock = DockStyle.Fill;
            contentViewerControl.Show();

            viewer.ShowDocument(contentViewerControl, docType, doc);




        }

    }
}
